/*
 * @description  : 内管应用接口
 * @descriptionDetail: 内管应用接口
 * @copyright    : 浙江烟草
 * @author       : lcm
 * @create       : 2022-09-27 09:58:57
 */

import apiUrl from "@/common/api_urls/internal";
import reqHelper from "@/common/reqHelper";
/**
 * 从审核审批对象中组装get请求数据
 * @param approve
 * @returns {string}
 */
function getApproveData(approve, nextPersons) {
  !approve.approveDate && (approve.approveDate = dateUtils.dateFormat("yyyy年MM月dd日", new Date()));
  return `?opType=${approve.opType}&gfaCode=${approve.gfaCode}&docInsUuid=${approve.docInsUuid}&isAgree=${approve.isAgree}&approvePersonUuid=${approve.approvePersonUuid}&approveDate=${encodeURIComponent(approve.approveDate)}&nextPersons=${nextPersons || ''}&approveInfo=${encodeURIComponent(approve.approveInfo)}`;
}
export default {
  /**
   * 损耗申报表列表分页查询
   * @param {*} page 
   * @param {*} limit 
   * @param {*} paras
   * @returns 
   */
  selectLossDeclarList(page, limit, paras) {
    return reqHelper.postJson({ page: page, limit: limit, paras: paras, }, apiUrl.internal.selectLossDeclarList);
  },
  /**
   * 运输申报列表分页查询
   * @param {*} page 
   * @param {*} limit 
   * @param {*} paras
   * @returns 
   */
  selectTranSportDeclarList(page, limit, paras) {
    return reqHelper.postJson({ page: page, limit: limit, paras: paras, }, apiUrl.internal.selectTranSportDeclarList
    );
  },
  /**
   * 运输申报记录新增
   * @param {*} paras 表单信息
   * @returns 
   */
  saveTranSportDeclar(paras) {
    return reqHelper.postJson(paras, apiUrl.internal.saveTranSportDeclar);
  },
  /**
   * 领料加工列表分页查询
   * @param {*} page 
   * @param {*} limit 
   * @param {*} paras
   * @returns 
   */
  selectPickProcessList(page, limit, paras) {
    return reqHelper.postJson({ page: page, limit: limit, paras: paras, }, apiUrl.internal.selectPickProcessList
    );
  },
  /**
   * 领料加工列表新增
   * @param {*} paras 表单信息
   * @returns 
   */
  savePickProcess(paras) {
    return reqHelper.postJson(paras, apiUrl.internal.savePickProcess);
  },
  /**
   * 数据看板-数据看板-市局
   * @param {*} paras 
   * @returns 
   */
  selectOutFlowpPanel(busUuid, params) {
    return reqHelper.postForm({busUuid: busUuid, portraitCode: 'I_PLATFORM_HOME', params:JSON.stringify(params),},apiUrl.internal.getPortraitInfo);
  },
  /**
   * 数据看板-数据看板-县局
   * @param {*} paras 
   * @returns 
   */
  selectOutFlowpPanelCounty(busUuid, params) {
    return reqHelper.postForm({busUuid: busUuid, portraitCode: 'I_PLATFORM_HOME_COUNTY', params:JSON.stringify(params),},apiUrl.internal.getPortraitInfo);
  },
  /**
   * 数据看板-内管预警
   * @param {*} paras 
   * @returns 
   */
  getPortraitInfo(busUuid, params) {
    return reqHelper.postForm({busUuid: busUuid, portraitCode: 'I_PLATFORM_WARN', params:JSON.stringify(params),},apiUrl.internal.getPortraitInfo);
  },
  /**
   * 数据看板-内管预警区县
   * @param {*} paras 
   * @returns 
   */
  getPortraitInfoConuty(busUuid, params) {
    return reqHelper.postForm({busUuid: busUuid, portraitCode: 'I_PLATFORM_WARN_COUNTY', params:JSON.stringify(params),},apiUrl.internal.getPortraitInfo);
  },
  /**
   * 数据看板-敏感品规
   * @param {*} paras 
   * @returns 
   */
  getPortraitInfoBrand(busUuid, params) {
    return reqHelper.postForm({busUuid: busUuid, portraitCode: 'I_PLATFORM_SENS_BRAND', params:JSON.stringify(params),},apiUrl.internal.getPortraitInfo);
  },
  /**
   * 数据看板-敏感品规区县
   * @param {*} paras 
   * @returns 
   */
  getPortraitInfoBrandCounty(busUuid, params) {
    return reqHelper.postForm({busUuid: busUuid, portraitCode: 'I_PLATFORM_SENS_COUNTY', params:JSON.stringify(params),},apiUrl.internal.getPortraitInfo);
  },
  /**
   * 数据看板-卷烟外流
   * @param {*} paras 
   * @returns 
   */
  getPortraitInfoOut(busUuid, params) {
    return reqHelper.postForm({busUuid: busUuid, portraitCode: 'I_PLATFORM_CIGA_OUT', params:JSON.stringify(params),},apiUrl.internal.getPortraitInfo);
  },

  /**
   * 数据看板-卷烟外流
   * @param {*} paras 
   * @returns 
   */
  getPortraitInfoOutCountry(busUuid, params) {
    return reqHelper.postForm({busUuid: busUuid, portraitCode: 'I_PLATFORM_OUTFLOW_COUNTY', params:JSON.stringify(params),},apiUrl.internal.getPortraitInfo);
  },
  /**
   * 数据看板-跨区异流
   * @param {*} paras 
   * @returns 
   */
  getPortraitInfoTran(busUuid, params) {
    return reqHelper.postForm({busUuid: busUuid, portraitCode: 'I_PLATFORM_CIGA_OUT_KQ', params:JSON.stringify(params),},apiUrl.internal.getPortraitInfo);
  },
  /**
   * 数据看板-内管工作-市局
   * @param {*} paras 
   * @returns 
   */
  getPortraitInfoWorks(busUuid, params) {
    return reqHelper.postForm({busUuid: busUuid, portraitCode: 'I_PLATFORM_CHECK', params:JSON.stringify(params),},apiUrl.internal.getPortraitInfo);
  },
  /**
   * 数据看板-内管工作-区县局
   * @param {*} paras 
   * @returns 
   */
  getPortraitInfoWorkq(busUuid, params) {
    return reqHelper.postForm({busUuid: busUuid, portraitCode: 'I_CIGA_WR_HOME', params:JSON.stringify(params),},apiUrl.internal.getPortraitInfo);
  },
  /** 领料加工详情查询
   * @param {*} pickId 领料加工记录uuid
   * @returns 
   */
  getPickProcess(pickId) {
    return reqHelper.postJson({ pickId: pickId, }, apiUrl.internal.getPickProcess);
  },
  /**
   * 运输申报详情查询
   * @param {*} transId 运输申报记录uuid
   * @returns 
   */
  getTranSportDeclar(transId) {
    return reqHelper.postJson({ transId: transId, }, apiUrl.internal.getTranSportDeclar);
  },
  /**
	 * 根据docCode获取文书信息
	 * @param {Object} docCode
	 */
  getInternalDocConfig(docCode){
    return reqHelper.postForm({ docCode: docCode, }, apiUrl.internal.getInternalDocConfig);	
  },
  /**
	 * 初始化文书实例接口
	 * @param {Object} paras
	 */
  initWasteDoc(typeCode,itemCode,docCode){
    let ps = `?typeCode=${typeCode}&itemCode=${itemCode}&docCode=${docCode}`;	
    return reqHelper.postForm({}, apiUrl.internal.initWasteDoc + ps);	
  },
  /* 损耗申报列表新增
  * @param {*} page 
  * @param {*} limit 
  * @param {*} paras
  * @returns 
  */
  lossDeclarSave(paras,docUuid,titemUuid) {
    let ps = `?docUuid=${docUuid}&titemUuid=${titemUuid}`;		
    return reqHelper.postJson(paras, apiUrl.internal.lossDeclarSave + ps);
  },
  /**
	 * 损耗申报提交
	 * @param {Object} paras
	 * @param {Object} docUuid
	 * @param {Object} titemUuid
	 * @param {Object} nextPersons
	 */
  lossDeclarSubmit(paras,docUuid,titemUuid,nextPersons) {
    let ps = `?docUuid=${docUuid}&titemUuid=${titemUuid}&nextPersons=${nextPersons}`;		
    return reqHelper.postJson(paras, apiUrl.internal.lossDeclarSubmit + ps);
  },
  /**
	 * 获取损耗申报信息
	 * @param {Object} paras
	 */
  lossDeclarGetDoc(paras) {
    return reqHelper.postForm(paras, apiUrl.internal.lossDeclarGetDoc);
  },
  /**
	 * 损耗申报 - 同意
	 * @param {Object} paras
	 * @param {Object} approve
	 * @param {Object} nextPersons
	 */
  lossDeclarAgree(paras, approve, nextPersons) {
    let sub = getApproveData(approve, nextPersons);
    return reqHelper.postJson(paras, apiUrl.internal.lossDeclarAgree + sub);
  },
  /**
	 * 损耗申报-退回
	 * @param {Object} paras
	 * @param {Object} approve
	 * @param {Object} nextPersons
	 */
  lossDeclarDisAgree(paras, approve, nextPersons) {
    let sub = getApproveData(approve, nextPersons);
    return reqHelper.postJson(paras, apiUrl.internal.lossDeclarDisAgree + sub);
  },
	
  /* 领料加工列表新增
	* @param {*} page 
	* @param {*} limit 
	* @param {*} paras
	* @returns 
	*/
  stockOutSave(paras,docUuid,titemUuid) {
    let ps = `?docUuid=${docUuid}&titemUuid=${titemUuid}`;		
    return reqHelper.postJson(paras, apiUrl.internal.stockOutSave + ps);
  },
  /**
	 * 领料加工提交
	 * @param {Object} paras
	 * @param {Object} docUuid
	 * @param {Object} titemUuid
	 * @param {Object} nextPersons
	 */
  stockOutSubmit(paras,docUuid,titemUuid,nextPersons) {
    let ps = `?docUuid=${docUuid}&titemUuid=${titemUuid}&nextPersons=${nextPersons}`;		
    return reqHelper.postJson(paras, apiUrl.internal.stockOutSubmit + ps);
  },
  /**
	 * 获取领料加工信息
	 * @param {Object} paras
	 */
  stockOutGetDoc(paras) {
    return reqHelper.postForm(paras, apiUrl.internal.stockOutGetDoc);
  },
  /**
	 * 领料加工 - 同意
	 * @param {Object} paras
	 * @param {Object} approve
	 * @param {Object} nextPersons
	 */
  stockOutAgree(paras, approve, nextPersons) {
    let sub = getApproveData(approve, nextPersons);
    return reqHelper.postJson(paras, apiUrl.internal.stockOutAgree + sub);
  },
  /**
	 * 领料加工-退回
	 * @param {Object} paras
	 * @param {Object} approve
	 * @param {Object} nextPersons
	 */
  stockOutDisAgree(paras, approve, nextPersons) {
    let sub = getApproveData(approve, nextPersons);
    return reqHelper.postJson(paras, apiUrl.internal.stockOutDisAgree + sub);
  },	
  /* 运输申报保存
	* @param {*} page 
	* @param {*} limit 
	* @param {*} paras
	* @returns 
	*/
  trafficDeclarSave(paras,docUuid,titemUuid) {
    let ps = `?docUuid=${docUuid}&titemUuid=${titemUuid}`;		
    return reqHelper.postJson(paras, apiUrl.internal.trafficDeclarSave + ps);
  },
  /**
	 * 运输申报提交
	 * @param {Object} paras
	 * @param {Object} docUuid
	 * @param {Object} titemUuid
	 * @param {Object} nextPersons
	 */
  trafficDeclarSubmit(paras,docUuid,titemUuid,nextPersons) {
    let ps = `?docUuid=${docUuid}&titemUuid=${titemUuid}&nextPersons=${nextPersons}`;		
    return reqHelper.postJson(paras, apiUrl.internal.trafficDeclarSubmit + ps);
  },
  /**
	 * 获取运输申报信息
	 * @param {Object} paras
	 */
  trafficDeclarGetDoc(paras) {
    return reqHelper.postForm(paras, apiUrl.internal.trafficDeclarGetDoc);
  },
  /**
	 * 运输申报 - 同意
	 * @param {Object} paras
	 * @param {Object} approve
	 * @param {Object} nextPersons
	 */
  trafficDeclarAgree(paras, approve, nextPersons) {
    let sub = getApproveData(approve, nextPersons);
    return reqHelper.postJson(paras, apiUrl.internal.trafficDeclarAgree + sub);
  },
  /**
	 * 运输申报-退回
	 * @param {Object} paras
	 * @param {Object} approve
	 * @param {Object} nextPersons
	 */
  trafficDeclarDisAgree(paras, approve, nextPersons) {
    let sub = getApproveData(approve, nextPersons);
    return reqHelper.postJson(paras, apiUrl.internal.trafficDeclarDisAgree + sub);
  },
	
  /* 处置申报-肥料加工保存
	* @param {*} page 
	* @param {*} limit 
	* @param {*} paras
	* @returns 
	*/
  punishDeclarFertilizerSave(paras,docUuid,titemUuid) {
    let ps = `?docUuid=${docUuid}&titemUuid=${titemUuid}`;		
    return reqHelper.postJson(paras, apiUrl.internal.punishDeclarFertilizerSave + ps);
  },
  /**
	 * 处置申报-肥料加工提交
	 * @param {Object} paras
	 * @param {Object} docUuid
	 * @param {Object} titemUuid
	 * @param {Object} nextPersons
	 */
  punishDeclarFertilizerSubmit(paras,docUuid,titemUuid,nextPersons) {
    let ps = `?docUuid=${docUuid}&titemUuid=${titemUuid}&nextPersons=${nextPersons}`;		
    return reqHelper.postJson(paras, apiUrl.internal.punishDeclarFertilizerSubmit + ps);
  },
  /**
	 * 获取处置申报-肥料加工信息
	 * @param {Object} paras
	 */
  punishDeclarFertilizerGetDoc(paras) {
    return reqHelper.postForm(paras, apiUrl.internal.punishDeclarFertilizerGetDoc);
  },
  /**
	 * 处置申报-肥料加工 - 同意
	 * @param {Object} paras
	 * @param {Object} approve
	 * @param {Object} nextPersons
	 */
  punishDeclarFertilizerAgree(paras, approve, nextPersons) {
    let sub = getApproveData(approve, nextPersons);
    return reqHelper.postJson(paras, apiUrl.internal.punishDeclarFertilizerAgree + sub);
  },
  /**
	 * 处置申报-肥料加工-退回
	 * @param {Object} paras
	 * @param {Object} approve
	 * @param {Object} nextPersons
	 */
  punishDeclarFertilizerDisAgree(paras, approve, nextPersons) {
    let sub = getApproveData(approve, nextPersons);
    return reqHelper.postJson(paras, apiUrl.internal.punishDeclarFertilizerDisAgree + sub);
  },
	
  /* 处置申报-其他保存
	* @param {*} page 
	* @param {*} limit 
	* @param {*} paras
	* @returns 
	*/
  punishDeclarOtherSave(paras,docUuid,titemUuid) {
    let ps = `?docUuid=${docUuid}&titemUuid=${titemUuid}`;		
    return reqHelper.postJson(paras, apiUrl.internal.punishDeclarOtherSave + ps);
  },
  /**
	 * 处置申报-其他提交
	 * @param {Object} paras
	 * @param {Object} docUuid
	 * @param {Object} titemUuid
	 * @param {Object} nextPersons
	 */
  punishDeclarOtherSubmit(paras,docUuid,titemUuid,nextPersons) {
    let ps = `?docUuid=${docUuid}&titemUuid=${titemUuid}&nextPersons=${nextPersons}`;		
    return reqHelper.postJson(paras, apiUrl.internal.punishDeclarOtherSubmit + ps);
  },
  /**
	 * 获取处置申报-其他信息
	 * @param {Object} paras
	 */
  punishDeclarOtherGetDoc(paras) {
    return reqHelper.postForm(paras, apiUrl.internal.punishDeclarOtherGetDoc);
  },
  /**
	 * 处置申报-其他 - 同意
	 * @param {Object} paras
	 * @param {Object} approve
	 * @param {Object} nextPersons
	 */
  punishDeclarOtherAgree(paras, approve, nextPersons) {
    let sub = getApproveData(approve, nextPersons);
    return reqHelper.postJson(paras, apiUrl.internal.punishDeclarOtherAgree + sub);
  },
  /**
	 * 处置申报-其他-退回
	 * @param {Object} paras
	 * @param {Object} approve
	 * @param {Object} nextPersons
	 */
  punishDeclarOtherDisAgree(paras, approve, nextPersons) {
    let sub = getApproveData(approve, nextPersons);
    return reqHelper.postJson(paras, apiUrl.internal.punishDeclarOtherDisAgree + sub);
  },
  /**
	 * 废弃品处置台账-待办流程
	 * @param {Object} flowGroupCode
	 */
  getFlowTaskPage(paras){
    return reqHelper.postJson(paras, apiUrl.internal.getFlowTaskPage);
  },
  /**
	 * 废弃品处置台账-已办结流程
	 * @param {Object} flowGroupCode
	 */
  getFlowTaskHandledPage(paras){
    return reqHelper.postJson(paras, apiUrl.internal.getFlowTaskHandledPage);
  },
  /**
	 * 废弃品处置台账-损耗申报列表
	 * @param {Object} paras
	 */
  lossDeclarList(paras){
    return reqHelper.postJson(paras, apiUrl.internal.lossDeclarList);
  },
  /**
	 * 废弃品处置台账-领料加工列表
	 * @param {Object} paras
	 */
  stockOutList(paras){
    return reqHelper.postJson(paras, apiUrl.internal.stockOutList);
  },
  /**
	 * 废弃品处置台账-运输申报列表
	 * @param {Object} paras
	 */
  trafficDeclarList(paras){
    return reqHelper.postJson(paras, apiUrl.internal.trafficDeclarList);
  },
  /**
	 * 废弃品处置台账-处置申报-肥料加工列表
	 * @param {Object} paras
	 */
  punishDeclarFertilizerList(paras){
    return reqHelper.postJson(paras, apiUrl.internal.punishDeclarFertilizerList);
  },
  /**
	 * 废弃品处置台账-处置申报-其他列表
	 * @param {Object} paras
	 */
  punishDeclarOtherList(paras){
    return reqHelper.postJson(paras, apiUrl.internal.punishDeclarOtherList);
  },
  /**
  * 真烟流动来源地
  * @param {*} page 
  * @param {*} limit 
  * @param {*} paras
  * @returns 
  */
  selectTrueCaseSourceList(page, limit, paras) {
    return reqHelper.postJson({ page: page, limit: limit, paras: paras, }, apiUrl.internal.selectTrueCaseSourceList);
  },
  /**
  * 真烟流动去向地
  * @param {*} page 
  * @param {*} limit 
  * @param {*} paras
  * @returns 
  */
  selectTrueCaseSourceOutList(page, limit, paras) {
    return reqHelper.postJson({ page: page, limit: limit, paras: paras, }, apiUrl.internal.selectTrueCaseSourceOutList);
  },
  /**
  * 真烟流动品规
  * @param {*} page 
  * @param {*} limit 
  * @param {*} paras
  * @returns 
  */
  selectTrueCaseCigaList(page, limit, paras) {
    return reqHelper.postJson({ page: page, limit: limit, paras: paras, }, apiUrl.internal.selectTrueCaseCigaList);
  },
  /**
  * 真烟流动品规被查获
  * @param {*} page 
  * @param {*} limit 
  * @param {*} paras
  * @returns 
  */
  selectTrueCaseCigaOutList(page, limit, paras) {
    return reqHelper.postJson({ page: page, limit: limit, paras: paras, }, apiUrl.internal.selectTrueCaseCigaOutList);
  },
  /**
  * 真烟流动区域
  * @param {*} page 
  * @param {*} limit 
  * @param {*} paras
  * @returns 
  */
  selectTrueCaseAreaList(page, limit, paras) {
    return reqHelper.postJson({ page: page, limit: limit, paras: paras, }, apiUrl.internal.selectTrueCaseAreaList);
  },
  /**
  * 真烟流动区域-被查获
  * @param {*} page 
  * @param {*} limit 
  * @param {*} paras
  * @returns 
  */
  selectTrueCaseAreaOutList(page, limit, paras) {
    return reqHelper.postJson({ page: page, limit: limit, paras: paras, }, apiUrl.internal.selectTrueCaseAreaOutList);
  },
  /** 
       * 外流客户列表分页查询
       * @param {*} page 
       * @param {*} limit 
       * @param {*} paras
       * @returns 
       */
  selectOutFlowCustList(page, limit, paras) {
    return reqHelper.postJson({ page: page, limit: limit, paras: paras, }, apiUrl.internal.selectOutFlowCustList
    );
  },
  /** 
       * 外流客户列表分页查询
       * @param {*} page 
       * @param {*} limit 
       * @param {*} paras
       * @returns 
       */
  getOutFlowCigaByParam(page, limit, paras) {
    return reqHelper.postJson({ page: page, limit: limit, paras: paras, }, apiUrl.internal.getOutFlowCigaByParam
    );
  },
   /** 
       * 打假打私统计查询
       * @param {*} page 
       * @param {*} limit 
       * @param {*} paras
       * @returns 
       */
   getCounterfeitingSmugglingReport(paras) {
      return reqHelper.postJson(paras, apiUrl.internal.getCounterfeitingSmugglingReport);
    },
}

